package com.ybc.chinese.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ybc.chinese.R;
import com.ybc.chinese.bean.Composition;
import com.ybc.chinese.utils.Contants;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * <p>作文详情(拼音，古诗，作文，成语)<p/>
 * Created by Yubch on 17/2/16.
 */
@Deprecated
public class CompositionDetailActivity extends BaseActivity {
    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.iv_left)
    ImageView ivLeft;
    @Bind(R.id.tv_content)
    TextView tvContent;
    private Composition composition;

    public static void newIntent(Context context, Composition composition) {
        Intent intent = new Intent(context, CompositionDetailActivity.class);
        intent.putExtra(Contants.INTENT_OBJ, composition);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_composition_detail);
        ButterKnife.bind(this);
        composition = (Composition) getIntent().getSerializableExtra(Contants.INTENT_OBJ);
        initView();
    }

    private void initView() {
        ivLeft.setImageResource(R.mipmap.ic_back);
        ivLeft.setVisibility(View.VISIBLE);
        tvTitle.setText(composition.getTitle());
        //tvContent.setText(composition.getContent());
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }

    @OnClick(R.id.iv_left)
    public void left() {
        finish();
    }
}
